<?php

use think\migration\Migrator;
use think\migration\db\Column;

class CapitalDetails extends Migrator
{
    public function up()
    {
        $table = $this->table('capital_details', array('comment' => '资金流水表'));
        $table->addColumn('user_id', 'integer', array('comment' => '会员id'))
              ->addColumn('user_mobile', 'string', array('limit' => 20, 'comment' => '会员帐号'))
              ->addColumn('types', 'string', array('limit' => 10, 'comment' => '类型'))
              ->addColumn('amount', 'integer', array('comment' => '金额'))
              ->addColumn('branch_id', 'integer', array('comment' => '分公司id'))
              ->addColumn('branch_name', 'string', array('limit' => 255, 'comment' => '分公司名称', 'null' => true))
              ->addColumn('camp_id', 'integer', array('comment' => '营地id'))
              ->addColumn('camp_name', 'string', array('limit' => 255, 'comment' => '营地名称', 'null' => true))
              ->addColumn('remark', 'string', array('limit' => 255, 'comment' => '支付备注', 'null' => true))
              ->addColumn('pay_channel', 'string', array('limit' => 255, 'comment' => '支付渠道','null' => true))
              ->addColumn('created_at', 'timestamp', array('default' => 'CURRENT_TIMESTAMP'))
              ->addColumn('updated_at', 'timestamp', array('null' => true))
              ->addColumn('deleted_at', 'timestamp', array('null' => true))
              ->addIndex('user_id')
              ->addIndex('id')
              ->save();   
    }
    public function down()
    {
        $this->dropTable('capital_details');
    }
}
